package cn.com.yto56.cainiao.exponent.common;

public final class QueryDSL {
    public static final String AGG = "{\n" +
            "  \"size\" : 0,\n" +
            "  \"query\" : {\n" +
            "    \"bool\" : {\n" +
            "      \"must\" : [ {\n" +
            "        \"range\" : {\n" +
            "          \"consumerTime\" : {\n" +
            "            \"gte\" : \"${startTime}T00:00:00.000+08:00\",\n" +
            "            \"lt\" : \"${endTime}T00:00:00.000+08:00\"\n" +
            "          }\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"match\" : {\n" +
            "          \"exponentType\" : \"${exponentType}\"\n" +
            "        }\n" +
            "      } ]\n" +
            "    }\n" +
            "  },\n" +
            "  \"aggs\" : {\n" +
            "    \"group\" : {\n" +
            "      \"terms\" : {\n" +
            "        \"field\" : \"exponetMsg.keyword\"\n" +
            "      }\n" +
            "    }\n" +
            "  }\n" +
            "}";

    public static final String TIMELY_CANVASS_LAN_SHOU = "{\n" +
            "  \"size\" : 0,\n" +
            "  \"query\" : {\n" +
            "    \"bool\" : {\n" +
            "      \"must\" : [ {\n" +
            "        \"range\" : {\n" +
            "          \"consumerTime\" : {\n" +
            "            \"gte\" : \"${startTime}T00:00:00.000+08:00\",\n" +
            "            \"lt\" : \"${endTime}T00:00:00.000+08:00\"\n" +
            "          }\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"range\" : {\n" +
            "          \"deliveryAndCanvassTimeDiff\" : {\n" +
            "            \"gt\" : 18\n" +
            "          }\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"match\" : {\n" +
            "          \"exponentType\" : \"及时揽收率\"\n" +
            "        }\n" +
            "      } ]\n" +
            "    }\n" +
            "  }\n" +
            "}";

    public static final String PERFECTION_GUO_JI = "{\n" +
            "  \"size\" : 0,\n" +
            "  \"query\" : {\n" +
            "    \"bool\" : {\n" +
            "      \"must\" : [ {\n" +
            "        \"range\" : {\n" +
            "          \"consumerTime\" : {\n" +
            "            \"gte\" : \"${startTime}T00:00:00.000+08:00\",\n" +
            "            \"lt\" : \"${endTime}T00:00:00.000+08:00\"\n" +
            "          }\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"match\" : {\n" +
            "          \"exponentType\" : \"信息完整率\"\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"prefix\" : {\n" +
            "          \"wayBillNo\" : \"G\"\n" +
            "        }\n" +
            "      } ]\n" +
            "    }\n" +
            "  }\n" +
            "}";


    public static final String ACCURACY_AGENT_POINT = "{\n" +
            "  \"size\" : 0,\n" +
            "  \"query\" : {\n" +
            "    \"bool\" : {\n" +
            "      \"must\" : [ {\n" +
            "        \"range\" : {\n" +
            "          \"consumerTime\" : {\n" +
            "            \"gte\" : \"${startTime}T00:00:00.000+08:00\",\n" +
            "            \"lt\" : \"${endTime}T00:00:00.000+08:00\"\n" +
            "          }\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"match\" : {\n" +
            "          \"exponentType\" : \"信息准确率\"\n" +
            "        }\n" +
            "      } ]\n" +
            "    }\n" +
            "  },\n" +
            "  \"aggs\" : {\n" +
            "    \"group\" : {\n" +
            "      \"terms\" : {\n" +
            "        \"field\" : \"agentPoint\"\n" +
            "      }\n" +
            "    }\n" +
            "  }\n" +
            "}";

    public static final String ACCURACY_UPDATE_AGENT_POINT = "{\"doc\" :{\"agentPoint\" : \"%s\"}}";

    public static final String FRONT_LOG_TEMPLATE = "{\n" +
            "  \"size\" : 1,\n" +
            "  \"query\" : {\n" +
            "    \"bool\" : {\n" +
            "      \"must\" : [ {\n" +
            "        \"match\" : {\n" +
            "          \"waybillNo\" : \"${mailNo}\"\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"match\" : {\n" +
            "          \"opCode\" : \"${opCode}\"\n" +
            "        }\n" +
            "      }, {\n" +
            "        \"range\" : {\n" +
            "          \"@timestamp\" : {\n" +
            "            \"gte\" : \"${startTime}T00:00:00.000+08:00\"\n" +
            "          }\n" +
            "        }\n" +
            "      } ]\n" +
            "    }\n" +
            "  }\n" +
            "}";
}
